home *** CD-ROM | disk | FTP | other *** search
/ Super Shareware Collection / Super Shareware Collection.iso / os_2 / memsz220.zip / RESTRING.CPP < prev    next >
Text File  |  1994-02-07  |  1KB  |  54 lines

  1. // Class RESTRING: Encapsulates the load/discard
  2. //   logic for a resource String Table entry.
  3.  
  4. #define INCL_BASE
  5. #include <os2.h>
  6.  
  7. #include "debug.h"
  8.  
  9. #include "restring.h"
  10.  
  11.  
  12.   // Constructor
  13.  
  14. ResourceString::ResourceString ( HMODULE Module, ULONG Id )
  15. {
  16.   SavedModule = Module ;
  17.   SavedId = Id ;
  18.  
  19.   APIRET Status = DosGetResource ( Module, RT_STRING, Id/16+1, &BlockPointer ) ;
  20.   if ( Status )
  21.   {
  22. //  Log (
  23. //    "ERROR: Unable to get string resource."
  24. //    "  Module %lu, id %lu, code %08lX.\r\n", SavedModule, SavedId, Status ) ;
  25.     return ;
  26.   }
  27.  
  28.   StringPointer = PBYTE(BlockPointer) + sizeof(USHORT) ;
  29.  
  30.   USHORT Index = (USHORT) ( Id % 16 ) ;
  31.   while ( Index-- )
  32.   {
  33.     StringPointer += *StringPointer ;
  34.     StringPointer ++ ;
  35.   }
  36.  
  37.   StringPointer ++ ;
  38. }
  39.  
  40.  
  41.   // Destructor
  42.  
  43. //ResourceString::~ResourceString ( )
  44. //{
  45. //  APIRET Status = DosFreeResource ( BlockPointer ) ;
  46. //  if ( Status )
  47. //  {
  48. //    Log (
  49. //    "ERROR: Unable to free string resource."
  50. //    "  Module %lu, id %lu, ptr %p, code %08lX.\r\n", SavedModule, SavedId, BlockPointer, Status ) ;
  51. //    return ;
  52. //  }
  53. //}
  54.